
local total = achievements.GetValue( "Roadkill", "total", 0 )

local veh = { "prop_vehicle_jeep", "prop_vehicle_airboat" }
local function PlayerKilled( msg )
	local ply = LocalPlayer()
	if ( !ValidEntity( ply ) ) then return end
	
	local victim, inflictor, attacker = msg:ReadEntity(), msg:ReadString(), msg:ReadString()
	
	if ( total != 100 && victim == ply && table.HasValue( veh, inflictor ) ) then
		total = math.Clamp( total + 1, 0, 100 )
		achievements.Update( "Roadkill", total / 100, total .. "/100" )
		achievements.SetValue( "Roadkill", "total", total )
	end
	
	return victim, inflictor, attacker
end
usermessage.AddHook( "PlayerKilled", "Achievements.RoadKill", PlayerKilled )

achievements.Register( "Roadkill", "Get run over 100 times.", "achievements/roadkill", total / 100, total .. "/100" )